<%@include file="/WEB-INF/pages/commons/commons.jsp" %>

<fmt:message var="title" key="blog_view_entry_comment_details.jsp.title" scope="request"/>
<stripes:layout-render name="${_themePath}/basic-layout-without-navbar.jsp" _title="${title}">
    
    <stripes:layout-component name="_content">
        
        <stripes:layout-component name="_topNav">
            <H1>Blog Management</H1>
            <UL class="gc-topnav-tabs">
                <LI>&nbsp;</LI>
            </UL>
        </stripes:layout-component>


        <h2>Comments</h2>
        <jsecurity:lacksPermission name="blog:viewBlogEntryComments:${actionBean.blogEntry.blog.id}">
            No "blog:viewBlogEntryComments:${actionBean.blogEntry.blog.id}" permission
        </jsecurity:lacksPermission>

        <jsecurity:hasPermission name="blog:viewBlogEntryComments:${actionBean.blogEntry.blog.id}">
        <c:choose>
            <c:when test="${not empty actionBean.blogEntryComments}">
                <c:forEach items="${actionBean.blogEntryComments}" var="comment" varStatus="stat">
                    <table width="100%">
                        <thead>
                            <tr>
                                <th><fmt:message key="blog_view_entry_comment_details.jsp.col_id"/></th>
                                <th>
                                    <c:out value="${comment.id}"/>
                                    <jsecurity:hasPermission name="blog:deleteBlogEntryComment:${actionBean.blogEntry.blog.id}">
                                    [<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="deleteBlogEntryComment">
                                        <stripes:param name="blogEntryComment" value="${comment.id}"/>
                                        <fmt:message key="blog_view_entry_comment_details.jsp.delete"/>
                                    </stripes:link>]
                                    </jsecurity:hasPermission>
                                    <jsecurity:hasPermission name="blog:viewBlogEntries:${actionBean.blogEntry.blog.id}">
                                    [<stripes:link beanclass="foo.bar.blog.web.action.registered.BlogsProfileActionBean" event="viewBlogEntries">
                                        <stripes:param name="blog" value="${actionBean.blogEntry.blog.id}"/>
                                        <fmt:message key="blog_view_entry_comment_details.jsp.backToBlogEntriesListing"/>
                                    </stripes:link>]
                                    </jsecurity:hasPermission>
                                </th>
                            </tr>
                            <tr>
                                <th><fmt:message key="blog_view_entry_comment_details.jsp.col_creationDate"/></th>
                                <th><fmt:formatDate value="${comment.creationDate}" pattern="dd/MM/yyyy hh:mm a"/></th>
                            </tr>
                            <tr>
                                <th><fmt:message key="blog_view_entry_comment_details.jsp.col_creator"/></th>
                                <th>
                                    <c:choose>
                                        <c:when test="${empty comment.creator}">
                                            <fmt:message key="global.anonymous"/>
                                        </c:when>
                                        <c:otherwise>
                                            <c:out value="${comment.creator.username}"/>
                                        </c:otherwise>
                                    </c:choose>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colspan="2">
                                    <div>
                                    <span class="radeox">
                                        <c:out value="${comment.decoratedContent}" escapeXml="false"/>
                                    </span>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </c:forEach>
            </c:when>
            <c:otherwise>
                <fmt:message key="blog_view_entry_comment_details.jsp.nocomments"/>
            </c:otherwise>
        </c:choose>
        </jsecurity:hasPermission>
    </stripes:layout-component>
</stripes:layout-render>

